﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Migrator.Util;
using System.Drawing;
using Migrator.Services.DHCP;
using Migrator.Packets;
using Migrator.Services.DHCP.Packets;
using System.Reflection;
using System.Diagnostics;
using Migrator.Core;
using Migrator.Services.MobileIPNodeService;
using Migrator.Services.RouteOptimization;

namespace Migrator.Entities
{
    public class MobileNode : Node
    {
        public MobileNode(MACAddress macAddress, IPAddress ipAddress, Router defaultRouter, PointF location)
            : base(macAddress, ipAddress, defaultRouter, location)
        {
            // Create the DHCP server
            this.services.Add(new DHCPClient(this).Configure());

            // MobileIP service for mobile nodes
            this.services.Add(new MobileIPNodeService(this).Configure());

            // Route optimization service
            this.services.Add(new RouteOptimizationService(this).Configure());
        }

        public override void Update()
        {
            base.Update();
        }

        protected override void ProcessPacket(IPPacket packet)
        {
            Debug.WriteLine(">>> " + this.ToString() + " received " + packet);

            base.ProcessPacket(packet);
        }
    }
}
